// @FileName  :encrypt.c
// @Time      :2024/3/7 11:30
// @Author    :YKW
//# include <bits/stdc++.h>
//using namespace std;
# include <stdio.h>
# include <stdlib.h>
# include <math.h>
# include <string.h>
# include <stdlib.h>

void main() {
    int crypt[26], c[26], cnt = 0, cnt2 = 0;
    char f[100];
    gets(f);
    memset(c, 0, sizeof(crypt));
    for (int i = 0; i < strlen(f); i++) {
        if (c[f[i] - 'a'] == 0) {
            c[f[i] - 'a']++;
            crypt[cnt++] = f[i] - 'a';
        }
    }
    for (int i = 25; i >= 0; i--) {
        if (c[i] == 0)
            crypt[cnt++] = i;
    }
    freopen("encrypt.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    while (gets(f) != NULL) {
        for (int i = 0; i < strlen(f); i++) {
            if (f[i] <= 'z' && f[i] >= 'a')
                printf("%c", crypt[f[i] - 'a'] + 'a');
            else
                printf("%c", f[i]);
        }
        puts("");
    }
}